import JSON
from urllib import parse, request


# def getOpenRoomList():
textmod = {'userId': '12410', 'chatId': '10062'}
textmod = parse.urlencode(textmod)
header_dict = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko',
    'token': '61ea92ab32003afb44ab5f8'}
url = 'http://192.168.62.35:30410/nlogin/'
req = request.Request(url='%s%s%s' % (url, '?', textmod), headers=header_dict)
res = request.urlopen(req)
ret = res.read()
jsonData = JSON.loads(ret)
print(jsonData)
resultcode = jsonData['ret']
if (0 == resultcode):
    print("get open room list succ!")
else:
    print("get open room list failed!")
    # return None
